package com;

import com.Util.DB;
import lombok.extern.slf4j.Slf4j;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

import static com.commont.TimeTask.*;

/**
 * 监听器
 */
@WebListener
@Slf4j
public class ServerListener implements ServletContextListener {

    @Override
    public void contextInitialized(ServletContextEvent sce) {
        //项目开启
        log.info ("【项目已经启动】");
        //初始化数据源
        DB db=new DB ();
        //  启动定时器任务测试(ok)
        //启动定时器每6秒发送消息
        //timer3 ();
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        //项目关闭
        log.info ( "【项目已经关闭】" );

    }
}
